package com.design.factory;

import java.util.Random;

/**
 * @Author: ChengLei.Liu
 * @Date: 2020-06-09 08:39
 * @Description: 简单工厂模式
 */
public class SimpleFactory {

    public static FactoryInterface getBean(){
        Random random = new Random();
        int i = random.nextInt(10);
        if(i>5){
            return new FactoryBean();
        }else{
            return new FactoryOtherBean();
        }
    }

    public static void main(String[] args) {
        FactoryInterface bean = SimpleFactory.getBean();
        System.out.println(bean);
    }
}
